<% if params[:controller] == "appointments" %>
<% prescription.drugs.each do | d | %>
<td>
  <%= link_to simple_icon('note'), edit_appointment_prescription_path(:id => prescription, :appointment_id => params[:id]) %> 
  <%= link_to feather_icon('trash'),appointment_prescription_path(:id => prescription, :appointment_id => params[:id]), method: :delete, data: { confirm: 'Are you sure?' }%>
</td>
  <td><%= d.name %></td>
  <td><%= prescription.dosage %></td>
  <td><%= prescription.quantity %></td>
  <td><%= prescription.fee %></td>
  <td><%= prescription.note %></td>
  <% end %>
<% else %>
<tr>	
  <td>
  <%= link_to simple_icon('note'), edit_appointment_prescription_path(:id => prescription, :appointment_id => params[:id]) %> 
  <%= link_to feather_icon('trash'),appointment_prescription_path(:id => prescription, :appointment_id => params[:id]), method: :delete, data: { confirm: 'Are you sure?' }%>
  </td>
  <td><%= prescription.id %></td>
  <td><%= prescription.appointment.patient.full_name %></td>
  <td><%= prescription.dosage %></td>
  <td><%= prescription.quantity %></td>
  <td><%= prescription.fee %></td>
  <td><%= prescription.note %></td>
</tr>
<% end %>